<?php
namespace app\admin\controller;
use think\Controller;
use think\Db;
    class Pay extends Common
{
    public function index(){
        $pay=Db::query("select y_id,y_type,u_name,p_id,ac_id,cc_id,co_id,y_time from pays p,users u where p.u_id=u.u_id");
        $this->assign("pay",$pay);
       /* if(y_type==1){
            $p_id=input('p_id');
            $p_name=Db::name("Pays")->where("p_id",$p_id)->select();
        }elseif (y_type==2){

        }elseif (y_type==3){

        }elseif (y_type==4){

        }*/

        return $this->fetch();
    }


    public function delete($id){
        if (Db::name("Pays")->delete($id)){
            $this->success('删除成功');
        }else $this->error('删除失败');
    }


        public function search(){
            $key=input('key');
            // dump($key);exit;
            if(!$key){
                $this->success('无搜索内容','Pay/index');
            }else{
                $pay=Db::table('Pays')->where('y_type','like',$key)->select();
                $this->assign("pay",$pay);
                // dump($activity);exit;
                return $this->fetch('index');

            }

            // dump($sql);
        }
        public function jiekou(){

            $rs=Db::name('Pays')->select();
            return json($rs);
        }

    }